<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="head.jsp" />
<link rel="stylesheet" type="text/css" href="${path}/css/monitor-job.min.css?" />
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="main" title="Go to Home" class="tip-bottom"><i
				class="icon-home"></i> Home</a> <a href="#" class="current">Job</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"><i class="icon-th"></i></span>
						<div class="buttons">
							&nbsp;<a href="javascript:location.reload()" target="_self"
									class="btn btn-mini btn-success"><i class="icon-refresh"></i>Update
									stats</a>
						</div>
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered data-table">
							<thead>
								<tr>
									<th>JobId</th>
									<th>文件名称</th>
									<th>工作类型</th>
									<th>工作状态</th>
									<th>任务数量</th>
									<th>创建时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${jobListMap}" var="map">
									<tr>
										<td><a href="task?jobId=${map.jobId}">${map.jobId}</a></td>
										<td>${map.originFilename}</td>
										<td>${map.taskType}</td>
										<td>
										     <c:choose>
												<c:when test="${map.jobStatus == 'failure'}">
													<span class="label label-warning">${map.jobStatus}</span>
												</c:when>
												<c:when test="${map.jobStatus == 'success'}">
													<span class="label label-success">${map.jobStatus}</span>
												</c:when>
												<c:when test="${map.jobStatus == 'created'}">
													<span class="label">${map.jobStatus}</span>
												</c:when>
												<c:when test="${map.jobStatus == 'running'}">
													<span class="label label-inverse">${map.jobStatus}</span>
												</c:when>
												<c:when test="${map.jobStatus == 'canceled'}">
													<span class="label label-important">${map.jobStatus}</span>
												</c:when>
												<c:otherwise>
													${map.jobStatus}
												</c:otherwise>
											</c:choose>
										</td>
										<td>${map.taskSize}</td>
										<td>${map.jobServerSumbitTime}</td>
										<td><a href="#" id=${map.jobId} class="btn btn-info btn-mini">Info</a></td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="modal fade in hide" id="config-modal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4>Job-detail</h4>
  </div>
  <div class="modal-body">
  	<table class="table table-bordered table-striped">
  		<tr>
    	   <td>JobId</td>
    	   <td id="jobId_modal">${jobId}</td>
    	</tr>
    	<tr>
    	   <td>工作类型</td>
    	   <td id="taskType_modal">${taskType}</td>
    	</tr>
        <tr>
    	   <td>工作状态</td>
    	   <td id="jobStatus_modal">${jobStatus}</td>
    	</tr>
    	<tr>
    	   <td>任务数量</td>
    	   <td id="taskSize_modal">${taskSize}</td>
    	</tr>
    	<tr>
    	   <td>创建时间</td>
    	   <td id="jobServerSumbitTime_modal">${jobServerSumbitTime}</td>
    	</tr>
    	<tr>
    	   <td>提交时间</td>
    	   <td id="inQuqueTime_modal">${inQuqueTime}</td>
    	</tr>
    	<tr>
    	   <td>处理时间</td>
    	   <td id="computeTime_modal">${computeTime}</td>
    	</tr>
    	<tr>
    	   <td>完成时间</td>
    	   <td id="completeTime_modal">${completeTime}</td>
    	</tr>
    	<tr>
    	   <td>等待时长</td>
    	   <td id="waitDuration_modal">${waitDuration}</td>
    	</tr>
    	<tr>
    	   <td>处理时长</td>
    	   <td id="computeDuration_modal">${computeDuration}</td>
    	</tr>
  	</table>
  </div>
</div>
<jsp:include page="footer.jsp" />
<script src="${path}/js/monitor-job.min.js"></script>
</body>
</html>